package com.itany.springcloud.springcloudgateway6002.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder builder){
        RouteLocatorBuilder.Builder routes=builder.routes();
        RouteLocator locator=routes.route("news_routes",r-> r.path("/guonei").uri("https://news.baidu.com/guonei"))
                                   .route("baike_routes",r->r.path("/art").uri("https://baike.baidu.com/art"))
                                   .build();
        return locator;
    }
}
